package com.test;

/*
class Animal {
    private String name;
    private int age;

    public Animal(String name, int age) {    // Animal类有参构造方法
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String info() {
        return "名称：" + this.getName() + ",年龄：" + this.getAge();
    }
}

class Dog extends Animal {
    private String color;

    public Dog(String name, int age, String color) {
        //通过super关键字调用Animal类有两个参数的构造方法
        super(name, age);
        this.setColor(color);
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    // 重写父类的info()方法
    public String info() {
        //扩充Dog类的对象
        return super.info()+",颜色："+this.getColor();
    }
}

public class Example02 {
    public static void main(String[] args){
        Dog dog=new Dog("花花狗",4,"black");
        System.out.println(dog.info());
    }

}

 */